package com.yanqu.road.server.cmd.union.cross.huaben;

import com.yanqu.road.pb.union.cross.UnionHuaBenProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.string.StringUtils;

@Cmd(code = Protocol.S_CROSS_UNION_HUA_BEN_GUAN_PU_RECORD_LIST, desc = "关扑奖励公告")
public class UnionHuaBenGuanPuHistoryRecordCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

        String unionUid = player.getUserInfo().getUnionUid();
        if(StringUtils.isNullOrEmpty(unionUid)){
            ret = GameErrorCode.E_UNION_NO_JOIN_UNION;
            return;
        }

        player.sendPacket(Protocol.C_CROSS_UNION_HUA_BEN_GUAN_PU_RECORD_LIST, UnionHuaBenProto.UnionHuaBenGuanPuHistoryRecordReqMsg.newBuilder());

    }

    @Override
    public void sendData(GamePlayer player) {
        if(ret != 0){
            player.sendPacket(Protocol.U_CROSS_UNION_HUA_BEN_GUAN_PU_RECORD_LIST, UnionHuaBenProto.UnionHuaBenGuanPuHistoryRecordRespMsg.newBuilder().setRet(ret));
        }
    }
}
